jQueryCS.fn.mmpositioning = function(o){
	 var options = jQuery.extend({
		MMContainerClass: '',
		MegaULClass: 'cs-megamenu-ul'
	 },o);
	 return this.each(function() {
		 if (o.MMContainerClass == undefined) {
		 	o.MMContainer = jQueryCS(this).parent('div');
		 } else {
		 	o.MMContainer = jQueryCS('.' + o.MMContainerClass);
		 }
		 // ul positioning
		jQueryCS(this).find(' .' + o.MegaULClass).each(function(){
            var ulWidth = jQueryCS(this).width();
            var contWidth = o.MMContainer.width();
            jQueryCS(this).css('max-width',contWidth);
			jQueryCS(o.MMContainer).css('position','relative');
			var ListLeftPos = jQueryCS(this).parent().position().left;
			var ListRightPos = (jQueryCS(this).parent().position().left)+(jQueryCS(this).parent().width());
			var DropDownLeftPos = (contWidth/2)-(ulWidth/2);
			var DropDownRightPos = ( DropDownLeftPos + ulWidth);
			if (ListLeftPos < DropDownLeftPos ) {
				DropDownLeftPos = ListLeftPos;
			} else 
			if (ListRightPos > DropDownRightPos ) {
				DropDownLeftPos = ListRightPos - (DropDownRightPos - DropDownLeftPos);
			}
			if (DropDownLeftPos < 0 ) {
				jQueryCS(this).css("left",0);
			} else 
			jQueryCS(this).css("left",DropDownLeftPos);
		
			// list item equal height
			var tallest = 0;
			var items = jQueryCS(this).children("li");
			items.each(function(){
				var thisHeight = jQueryCS(this).outerHeight();
				if(thisHeight > tallest) {
					tallest = thisHeight;
				}
			});
			items.height(tallest);
		});
	 });
}